const { Success, Fail, Custom } = require("../../utils/status");
const moment = require("moment");
const { selectDownloadHistoryUserId } = require("../../service/downloadhistory")
module.exports = {
    downloadHistoryList: async (ctx) => {
        let { id, username } = ctx.state.user;
        let { startTime = "", endTime = "", pageSize = 10, pageNum = 1 } = ctx.request.body;
        var send;
        var { count, rows } = await selectDownloadHistoryUserId({
            userId: id,
            startTime: startTime ? moment(startTime).format("YYYY-MM-DD HH:mm:ss") : '',
            endTime: endTime ? moment(endTime).format("YYYY-MM-DD HH:mm:ss") : '',
            pageSize,
            pageNum
        })
        send = new Success({
            data: { data: rows, total: count },
            msg: "成功！"
        });
        ctx.body = send
    },
}